package com.k1998.mybatis.service.impl;

import com.k1998.mybatis.bean.JxIndex;
import com.k1998.mybatis.dao.IJxIndexDao;
import com.k1998.mybatis.service.JxIndexService;
import com.k1998.mybatis.utils.HashMapUtils;
import com.k1998.mybatis.utils.JxUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: ChenYuxiang
 * @Description: //TODO
 * @Param:
 * @return:
 * @Date: 18:05 2021/2/20
 **/
@Service("JxIndexService")
public class JxIndexImpl implements JxIndexService {
    @Autowired
    private IJxIndexDao iJxIndexDao;
    @Override
    public String getAllJxindexs() {
        int count=iJxIndexDao.getCount();
        List<JxIndex> jx=iJxIndexDao.getAll();
        String result=HashMapUtils.toHashMap(count,jx);
        return result;
    }

    @Override
    public int batchJudge(String ids) {
        List<String> list= JxUtils.stringToList(ids);
        if(null==list){return 0;}
        iJxIndexDao.batchDeleteJxIndex(list);
        return 1;
    }
}
